//
//  AffirmOrderHeaderCell.m
//  much
//
//  Created by weijunjie on 2019/1/10.
//  Copyright © 2019年 iOS. All rights reserved.
//

#import "AffirmOrderHeaderCell.h"

static NSString *AffirmOrderHeaderCellIdentifier = @"AffirmOrderHeaderCellIdentifier";
@interface AffirmOrderHeaderCell ()
@property (strong, nonatomic) UILabel * storeIconLabel;//图标
@property (strong, nonatomic) UILabel * storeNameLabel;//商家名字
@end
@implementation AffirmOrderHeaderCell

+ (instancetype)orderHeaderCellWithTableView:(UITableView *)tableView {
    AffirmOrderHeaderCell *headerCell = [tableView dequeueReusableHeaderFooterViewWithIdentifier:AffirmOrderHeaderCellIdentifier];
    if (!headerCell) {
        headerCell = [[AffirmOrderHeaderCell alloc] initWithReuseIdentifier:AffirmOrderHeaderCellIdentifier];
    }
    return headerCell;
}

- (void)setStoreName:(NSString *)storeName {
    _storeName = [storeName copy];
    self.storeNameLabel.text = storeName;
}

- (UILabel *)storeIconLabel {
    if (!_storeIconLabel) {
        _storeIconLabel = [[UILabel alloc] init];
        _storeIconLabel.font = ICONFONT(14);
        _storeIconLabel.textColor = Color140;
        _storeIconLabel.text = N_STORE;
        [self.contentView addSubview:_storeIconLabel];
        [_storeIconLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(15);
            make.centerY.equalTo(self.contentView);
        }];
    }
    return _storeIconLabel;
}

- (UILabel *)storeNameLabel {
    if (!_storeNameLabel) {
        _storeNameLabel = [[UILabel alloc] init];
        _storeNameLabel.font = APPFONT(14);
        [self.contentView addSubview:_storeNameLabel];
        [_storeNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.storeIconLabel.mas_right).with.offset(8);
            make.centerY.equalTo(self.storeIconLabel);
        }];
    }
    return _storeNameLabel;
}

@end
